 
 //Clases para puntos
 function point (pX,pY,id){
     var ptX= pX;
     var ptY= pY;
     var ID = id;
     
     this.getX=function(){
       return ptX;
     }
     
     this.getY=function(){
       return ptY;
     }
     
     this.getID=function(){
       return ID;
     }
     
     this.setData=function(pX,pY,id){
       this.ptX=pX;
       this.ptY=pY;
       this.ID=id;
     }
   }
   
   
   //Clase para circulos de cada nodo
   function Circulos(px,py,rd,_id,options){
     var defaultOptions={
       color:'#235',
       highlight:'#cfc',       
       selColors:{
	      'J1':'#dc143c',
	      'J2':'#006400'
	     },
       active:false	   
     };
     
     this.nX=px || 0;
     this.nY=py || 0
     this.rad=rd || 10;
     this.id=_id || 0;
     
     options = options || {};
     for(var i in defaultOptions){
       if(options[i]){
          this[i]=options[i];
       } 
       else
         this[i]=defaultOptions[i];
     }
               
   }
   
   Circulos.prototype={
     draw : function(ctx, canvas) {
           ctx.save();
          ctx.fillStyle = this.color;
          ctx.beginPath();
          ctx.arc(this.nX, this.nY, this.rad, 0, Math.PI*2, false);
          ctx.fill();
          ctx.restore();
     },
    
    toggleHover: function() {
     if(!this.active){ 
      var c = this.color;
      this.color = this.highlight;
      this.highlight = c;
     }
    },
    
    setActive:function(){
    
	    this.active=true;
	  },
	
	  setColor: function(player){
	     this.color=this.selColors[player];
	    
	   }
 };

